
package org.rescue.analysis;

import java.util.Enumeration;

import javax.swing.tree.DefaultMutableTreeNode;

import org.rescue.analysis.summarize.SCandidateData;
import org.rescue.search.*;

/**
 * @author jlickfet
 *
 */
public class DatasetAnalysis {

	AnalysisOperation analysisOperation;
	AnalysisResult result;
	
	public void performAnalysis(Dataset dataset, int k) {
		result = analysisOperation.analyze(dataset, k);
	}

	
	public void setAnalysisOperation(AnalysisOperation analysisOperation) {
		this.analysisOperation = analysisOperation;
	}
	
	public AnalysisResult getResult() {
		return result;
	}
	 
	public void setResult(AnalysisResult result) {
		this.result = result;
	}
	
	public void printAnalysisResults() {
		
		Enumeration e = result.getResultTree().breadthFirstEnumeration();
		while (e.hasMoreElements()) {
			DefaultMutableTreeNode candNode = (DefaultMutableTreeNode)e.nextElement();
			SCandidateData candNodeData = (SCandidateData)candNode.getUserObject();
			System.out.println(candNodeData.getLabel() + " " + candNodeData.getInfoLoss());
		}

	
	}
	
}
